<DOCTYPE html>
<!--HTML5 doctype-->
<html>
<head>
	<title>巡查记录</title>
	<meta http-equiv="Content-type" content="text/html; charset=utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0">
	<meta name="apple-mobile-web-app-capable" content="yes" />
	<link rel="stylesheet" type="text/css" href="../../css/jquery.mobile-1.4.0.css" />
	<link rel="stylesheet" type="text/css" href="../../css/zpdydhl_mobile.css">
	<link rel="stylesheet" type="text/css" href="../../css/mobiscroll.custom-2.6.2.min.css">
	<script type="text/javascript" src="../../js/jquery-1.8.3.min.js"></script>
	<script type="text/javascript" src="../../js/zpdydhl_mobile.js"></script>
	<script type="text/javascript" src="../../js/mobiscroll.custom-2.6.2.min.js"></script>
	<style type="text/css">
        .xuncha_item {
            display: block;
            background-color: #dddddd;
            width: 130px;
            height: 30px;
            cursor: pointer;
            border-radius: 10px;
            text-align: center;
            padding-top: 15px;
            margin-top: 10;
        }
        .xuankaung_img {
            vertical-align: middle;
            margin-top: -4px;
            margin-right: 7px;
        }
    </style>
</head>
<body>
	<div class="ui-page ui-page-theme-c ui-page-header-fixed ui-page-active ttm_ui_page">
			
		
		<form method="post" action="/zpdydhl/Mobile/XunchaJilu/addXunchaJilu" name="xunshi_jilu_form">        
			<table width="100%" border="0" height="52">
				<tr>
					<td class="yizhu_baiyao_shaixuan_name" style="width:25%;">巡视时间：</td>
					<td class="yizhu_baiyao_shaixuan_input">
						<input type="text" name="tizheng_input_time" id="tizheng_input_time" value="" data-role="none" style="text-align:center;">
					</td> 
					<td>
						<input type="button" value="历史" id="lishi_xuncha" class="search_button jiancha_search yizhu_search" data-role="none" style="margin-left:0px;"/>
					</td>
				</tr>
			</table>
			<table class="yizhu_baiyao_list" border="0" height="23">
				<tr>           
					<td width="100%"  align="center" valign="middle">巡视内容</td>
				</tr>
			</table>
			<div class="xuncha_checkbox" >
				
			</div>
			<table width="100%" class="xuncha_label">
				
			</table>
		</form>
	</div>
	<script type='text/javascript'>
	    $(function () {
			//setHeader()
	    	//设置改页面的值，用于判断当点击患者列表后，响应页面操作
	    	document_type_global = "xunchaJilu";

			//设置体征录入时间选择框，为其添加控件
			selectInputTime("tizheng_input_time",true);
	    });

		function refreshData()
		{
			// 获取巡视项目
			getXunchaItemList();
		}
	   
	    $("#lishi_xuncha").die().live("mousedown",function(){
			window.location.href = "./showLishiXuncha.html";
		});

	    $(".xuncha_item").die().live("mousedown",function(){
	        var input_id = $(this).attr("for");
	        
	        if($("#"+input_id).attr("name")==null||$("#"+input_id).attr("name")=="")
	        {
	            $(this).css("background-color","gray");
	            $(this).removeClass("xuncha_item_img");
	            $(this).addClass("xuncha_item_img_hover");
	            $(this).css("color","white");
	            $("#"+input_id).attr("name","xuncha_item_checked[]");
	        }
	        else
	        {
	            $(this).css("background-color","#dddddd");
	            $(this).css("color","black");
	            $("#"+input_id).attr("name","");
	            $(this).removeClass("xuncha_item_img_hover");
	            $(this).addClass("xuncha_item_img");
	        }
	    });

	    $("#xunshi_form").die().live('click',function(){
			if(confirm("确认上传"))
			{
				$.ajax({
	                type: "get",
	                async: false,
	                url:server_url+"Mobile/XunchaJilu/addXunchaJiluJson/zhuyuan_id/"+patient_info_global.zhuyuan_id+"/patient_id/"+patient_info_global.patient_id+"/doctor_name/"+nurse_info_global.user_name+"/user_number/"+nurse_info_global.user_number+yiyuan_id,
	                data:$('form[name="xunshi_jilu_form"]').serialize(),
	                dataType: "jsonp",
	                jsonp: "callbackAddXunchaJiluJson",
	                jsonpCallback:"feedBackStateAddXunchaJiluJson",
	                error:function(mes)
	                {
	                    alert("请求失败，请稍后重试");
	                },
	                success: function(result) {
	                	if(result.ret == "success"){
	                		alert("上传成功");
	                		$('#tizheng_list').html("<tr><th>类别</th><th>方式</th><th>检查值</th><th>管理</th></tr>");
	                		$(".xuncha_checkbox input").attr("name","");
	                		$(".xuncha_item").css("background-color","#dddddd");
	                		$(".xuncha_item").css("color","black");
	                		$(".xuncha_item").removeClass("xuncha_item_img_hover");	
	                		$(".xuncha_item").addClass("xuncha_item_img");
	                	}else{

	                	}
	                }
	            });
			}
		});

		// 获取巡视项目
		function getXunchaItemList()
		{
			$.ajax({
	            type: "get",
	            async: false,
	            url:server_url+"Mobile/XunchaJilu/getXunchaItemListJson"+yiyuan_id,
	            data:{},
	            dataType: "jsonp",
	            jsonp: "callbackGetXunchaItemListJson",
	            jsonpCallback:"feedBackStateGetXunchaItemListJson",
	            error:function(mes)
	            {
	                alert("请求失败，请稍后重试");
	            },
	            success: function(result) {
	            	if(result.ret == "success")
	            	{
	            		if(result.data == null)
	            		{
	            			return;
	            		}

	            		var xuncha_item_list = result.data;
	            		var str_html_xuncha_check_box = "";
	            		var str_html_xuncha_label = "";
		                for(var i=0;i<xuncha_item_list.length;i++)
		                {
		                	str_html_xuncha_check_box += '<input type="hidden" id="'+xuncha_item_list[i]["xuncha_item_code"]+'" value="'+xuncha_item_list[i]["xuncha_item_code"]+'"/>';
		                	if(i%2==0)
		                	{
		                		str_html_xuncha_label += '<tr>';
		                	}
		                	str_html_xuncha_label += '<td align="center">'+
		                								'<span for="'+xuncha_item_list[i]["xuncha_item_code"]+'" class="xuncha_item_img xuncha_item">'+xuncha_item_list[i]["xuncha_item_name"]+'</span>'+
		                							'</td>';
		                	if(i%2==1)
		                	{
		                		str_html_xuncha_label += '</tr>';
		                	}
		                }

		                $(".xuncha_checkbox").html(str_html_xuncha_check_box);
		                $(".xuncha_label").html(str_html_xuncha_label);
	            	}
	            	else
	            	{
	            		alert(result.msg);
	            	}
	            }
	        });
		}
	</script>
</body>
</html>